<?php
class Metro extends AppModel {
// Define the model and it's associations:
var $name = 'Metro';
var $hasMany = array(
			'Town' => array(
				'className' => 'Town',
				'foreignKey' => 'metro_ID',
				'dependent' => 'false'
				)
			);
var $hasAndBelongsToMany = array(
							'Page' => array(
								'className' => 'Page',
								'joinTable' => 'objects_pages',
								'foreignKey' => 'object_ID',
								'associationForeignKey' => 'page_ID',
								'unique' => true
								)
							);

	/*
	/	fetchMetroInfoByName: fetch Metro info by it's host name
	/	string $host_name: host name
	*/
	public function fetchMetroInfoByName($host_name) {
		$metroinfo = $this->find('first', array(
			'conditions' => array(
				'Metro.host_name' => $host_name)/*,
			'fields' => array(
				'Metro.ID')*/));
		return $metroinfo;
	}
	
	
	/*
	/	fetchMetroByName: fetch Metro by it's ID
	/	string $host_name: host name
	*/
	public function fetchMetro($metro_id) {
		$metro = $this->find('first', array(
			'conditions' => array(
				'Metro.host_name' => $host_name)));
		return $metro;
	}
}
?>
